/**
  * @file		crc.h
  * @author		Krubkib
  * @version	V1.0.0
  * @date		October 19, 2013
  * @brief		Header of helper module
  */
#ifndef __CRC_H
#define __CRC_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
#include <stm32f4xx.h>
	 
/* Public typedef ------------------------------------------------------------*/
	 typedef uint16_t crc;
/* Public define -------------------------------------------------------------*/
	 #define INITIAL_REMAINDER 0xFFFF
	 #define FINAL_XOR_VALUE 0x0000
	 #define WIDTH  (8 * sizeof(crc))
	 #define TOPBIT (1 << (WIDTH - 1))
	 #define POLYNOMIAL 0x1021
/* Public macro --------------------------------------------------------------*/
/* Public variables ----------------------------------------------------------*/
/* Public function prototypes ------------------------------------------------*/
crc crcSlow(uint8_t const message[], int nBytes);
void crcInit(void);
crc crcFast(uint8_t const message[], int nBytes);
	 
#ifdef __cplusplus
}
#endif

#endif /* __CRC_H */
